<template>
  <div class="work">
    <el-container class="work">
      <el-aside width="200px">
        <!-- 侧边栏菜单区域 -->
        <el-menu :default-active="activeIndex"
                 class="el-menu-vertical-demo"
                 background-color="#373d41"
                 text-color="#fff"
                 active-text-color="#409EFF" router unique-opened>
          <el-menu-item index="/sgjg" @click="saveActivePath('/sgjg')">
            <template slot="title">
              <!-- 图标 -->
              <i class="el-icon-location"></i>
              <!-- 文本 -->
              <span>施工监管</span>
            </template>
          </el-menu-item>

          <el-menu-item index="/wxjh"  @click="saveActivePath('/wxjh')">
            <template slot="title">
              <!-- 图标 -->
              <i class="el-icon-location"></i>
              <!-- 文本 -->
              <span>维修计划</span>
            </template>
          </el-menu-item>
        </el-menu>
      </el-aside>
      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </div>
</template>

<script>
  export default {
    name: "TodayWork",
    data() {
      return {
        activeIndex: '/sgjg',
      }
    },
    created() {
      const path =  window.sessionStorage.getItem("twPath");
      if(path!=null){
        this.activeIndex = path;
        this.$router.push(path);
      }

    },
    methods:{
      saveActivePath(active){
        window.sessionStorage.setItem('twPath',active)
      }
    }
  }
</script>

<style lang="less" scoped>
  .el-menu.el-menu--horizontal{
    border-bottom: none;
  }
  .el-aside {
    background-color: #373d41;
    width: 100%;
    .el-menu {
      border-right: none;
      width: 100%;
    }
  }

  .el-main {
    background-color: #eaedf1;
    height: 100%;
    padding: 0;
  }

  .work {
    height: 100%;
  }
</style>
